package cn.portx.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.bstek.bdf3.dorado.jpa.annotation.Generator;
import com.bstek.dorado.annotation.PropertyDef;

import cn.portx.annotation.ChineseField;
import cn.portx.policy.ChineseToCodeGeneratorPolicy;
import cn.portx.policy.CreateUserPolicy;
import cn.portx.policy.CreatedDatePolicy;
import cn.portx.policy.IdGeneratorPolicy;

/**
 * Model class of 费用条目.
 * 
 * @author generated by ERMaster
 * @version $Id$
 */
@Entity
@Table(name = "T_EXPENSE_ITEM")
public class ExpenseItem extends BaseEntity {

	/** serialVersionUID. */
	private static final long serialVersionUID = 1L;

	/** 费用代码. */
	@Column(name = "CODE_", length = 15)
	@ChineseField("name")
	@Generator(policy = ChineseToCodeGeneratorPolicy.class)
	@PropertyDef(label = "费用代码", description = "费用代码:费用代码")
	private String code;

	/** 费用名称. */
	@Column(name = "NAME_", length = 30)
	@PropertyDef(label = "费用名称", description = "费用名称:费用名称")
	private String name;

	/** 费用类型. */
	@Column(name = "TYPE_", length = 1)
	@PropertyDef(label = "费用类型", description = "费用类型:费用类型，0：应收；1：应付；2：成本")
	private String type;

	/** 是否常用. */
	@Column(name = "IN_COMMON_USE_")
	@PropertyDef(label = "是否常用", description = "是否常用:是否常用")
	private Integer inCommonUse;

	/** 支付单位 或 结算对象 */
	@Column(name = "ZFDW_", length = 2)
	@PropertyDef(label = "支付单位", description = "支付单位 或 结算对象，0：本港车队；1：司机；2：船公司；3：目的港车队；4：保险公司；5：客户；6：码头；7：短驳车队；8：其他")
	private String dw;

	/**
	 * Constructor.
	 */
	public ExpenseItem() {
	}

	/**
	 * Set the 费用代码.
	 * 
	 * @param code
	 *            费用代码
	 */
	public void setCode(String code) {
		this.code = code;
	}

	/**
	 * Get the 费用代码.
	 * 
	 * @return 费用代码
	 */
	public String getCode() {
		return this.code;
	}

	/**
	 * Set the 费用名称.
	 * 
	 * @param name
	 *            费用名称
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Get the 费用名称.
	 * 
	 * @return 费用名称
	 */
	public String getName() {
		return this.name;
	}

	/**
	 * Set the 费用类型.
	 * 
	 * @param type
	 *            费用类型
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * Get the 费用类型.
	 * 
	 * @return 费用类型
	 */
	public String getType() {
		return this.type;
	}

	/**
	 * Set the 是否常用.
	 * 
	 * @param inCommonUse
	 *            是否常用
	 */
	public void setInCommonUse(Integer inCommonUse) {
		this.inCommonUse = inCommonUse;
	}

	/**
	 * Get the 是否常用.
	 * 
	 * @return 是否常用
	 */
	public Integer getInCommonUse() {
		return this.inCommonUse;
	}

	public String getDw() {
		return dw;
	}

	public void setDw(String dw) {
		this.dw = dw;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
		return result;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		ExpenseItem other = (ExpenseItem) obj;
		if (this.getId() == null) {
			if (other.getId() != null) {
				return false;
			}
		} else if (!this.getId().equals(other.getId())) {
			return false;
		}
		return true;
	}

}
